import {createRouter, createWebHistory} from 'vue-router'

const Login = () => import('../views/Login')
const Layout = () => import('../layout/Layout')
const AddPaper = () => import('../views/AddPaper')
const SearchPaper = () => import('../views/SearchPaper')
const AddTreatise = () => import('../views/AddTreatise')
const AddAchieve = () => import('../views/AddAchieve')
const SearchAchieve = () => import('../views/SearchAchieve')
const AddReward = () => import('../views/AddReward')
const SearchReward = () => import('../views/SearchReward')
const PersonalCenter = () => import('../views/PersonalCenter')
const AddUser = () => import('../views/AddUser')
const SearchTreatise = () => import('../views/SearchTreatise')
const AddItem = () => import('../views/AddItem')
const SearchItem = () => import('../views/SearchItem')
const SearchUser = () => import('../views/SearchUser')
const SearchPatent = () => import('../views/SearchPatent')
const AddPatent = () => import('../views/AddPatent')
const AddNewspaper = () => import('../views/AddNewspaper')
const SearchNewspaper = () => import('../views/SearchNewspaper')

const routes = [
    {
        path: '/',
        name: 'Layout',
        component: Layout,
        //路由自动跳转
        redirect: "/login",
        children:[
            {
                path: 'addItem',
                name: 'AddItem',
                component: AddItem
            },
            {
                path: 'searchItem',
                name: 'SearchItem',
                component: SearchItem
            },
            {
                path: 'searchPatent',
                name: 'SearchPatent',
                component: SearchPatent
            },
            {
                path: 'searchNewspaper',
                name: 'SearchNewspaper',
                component: SearchNewspaper
            },
            {
                path: 'addNewspaper',
                name: 'AddNewspaper',
                component: AddNewspaper
            },
            {
                path: 'searchUser',
                name: 'SearchUser',
                component: SearchUser
            },
            {
                path: 'addPatent',
                name: 'AddPatent',
                component: AddPatent
            },
            {
                path: 'searchTreatise',
                name: 'SearchTreatise',
                component: SearchTreatise
            },
            {
                path: 'addAchieve',
                name: 'AddAchieve',
                component: AddAchieve
            },
            {
                path: 'addPaper',
                name: 'AddPaper',
                component: AddPaper
            },
            {
                path: 'searchPaper',
                name: 'SearchPaper',
                component: SearchPaper
            },
            {
                path: 'addTreatise',
                name: 'AddTreatise',
                component: AddTreatise
            },
            {
                path: 'addReward',
                name: 'AddReward',
                component: AddReward
            },
            {
                path: 'searchAchieve',
                name: 'SearchAchieve',
                component: SearchAchieve
            },
            {
                path: 'searchReward',
                name: 'SearchReward',
                component: SearchReward
            },
            {
                path: 'personalCenter',
                name: 'PersonalCenter',
                component: PersonalCenter
            },
            {
                path: 'addUser',
                name: 'AddUser',
                component: AddUser
            },

        ]
    },
    {
        path: '/login',
        name: 'Login',
        component: Login
    },
]

const router = createRouter({
    history: createWebHistory(process.env.BASE_URL),
    routes
})

export default router
